﻿<Page
    x:Class="SS.HP.Win8.Views.MainView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:SS.HP.Win8.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:i="using:Windows.UI.Interactivity"
    xmlns:cal="using:Caliburn.Micro"
    mc:Ignorable="d">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="80"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="120"></RowDefinition>
        </Grid.RowDefinitions>
        <Button x:Name="GoBack" Style="{StaticResource BackButtonStyle}" Grid.Row="2"/>

        <Button Name="ClearCart" Grid.Column="1" Grid.Row="0" Background="{x:Null}">Clear Cart</Button>

        <ListView ItemsSource="{Binding BooksInCart}" Grid.Column="1" Grid.Row="1" Width="240" AllowDrop="True"
                  ItemTemplate="{StaticResource Standard80ItemTemplate}" Background="#FF411414" SelectionMode="None" 
                  >
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Drop">
                    <cal:ActionMessage MethodName="BookDropped">
                        <cal:Parameter Value="$eventArgs"></cal:Parameter>
                    </cal:ActionMessage>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </ListView>

        <TextBlock Text="{Binding Title}" Style="{StaticResource PageHeaderTextStyle}" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="2" />

        <TextBlock Text="{Binding CartPrice}" 
                   Grid.Column="2" Grid.Row="0" Grid.RowSpan="2"
                   Margin="10,20,0,200" 
                   Style="{StaticResource HeaderTextStyle}"
                   />

        <ListView ItemsSource="{Binding Books}"
                  Grid.Column="0" Grid.Row="0" Grid.RowSpan="2"
                  ItemTemplate="{StaticResource Standard80ItemTemplate}"
                  CanDragItems="True" DragItemsStarting="ListView_DragItemsStarting" 
                  >
        </ListView>
    </Grid>
</Page>